Skip to content

[concurrency] Fix optimize_hop_to_executor so that we take advantage of the new nonisolated(nonsending) ABI in post 6.2. #83295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gottesmm
Copy link
Contributor

Specifically:

  1. We assume in nonisolated(nonsending) that we are already on the relevant actor. This lets us always eliminate the initial hop_to_executor.

  2. We stopped treating nonisolated(nonsending) functions as suspension points since we are guaranteed to always be on the same actor when we enter/return.

  3. Now that nonisolated(nonsending) is no longer a suspension point, I could sink the needs executor nonisolated(nonsending) specific code into the needs executor code. For those unfamiliar it is that we: a. treat a nonisolated(nonsending) callee as a needs executor since we are no longer guaranteed to hop in callees and b. treat returns from nonisolated(nonsending) functions as being a needs executor instruction since we are no longer guaranteed to hop in the caller after such a function returns.

rdar://155465878


NOTE: I just had this locally already done, so I am uploading it now to main.

@gottesmm gottesmm requested review from eeckstein and ktoso as code owners July 24, 2025 15:37
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm enabled auto-merge July 24, 2025 15:37
@gottesmm gottesmm disabled auto-merge July 28, 2025 17:49
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

…of the new nonisolated(nonsending) ABI in post 6.2.

Specifically:

1. We assume in nonisolated(nonsending) that we are already on the relevant
actor. This lets us always eliminate the initial hop_to_executor.

2. We stopped treating nonisolated(nonsending) functions as suspension points
since we are guaranteed to always be on the same actor when we enter/return.

3. Now that nonisolated(nonsending) is no longer a suspension point, I could
sink the needs executor nonisolated(nonsending) specific code into the needs
executor code. For those unfamiliar it is that we: a. treat a
nonisolated(nonsending) callee as a needs executor since we are no longer
guaranteed to hop in callees and b. treat returns from nonisolated(nonsending)
functions as being a needs executor instruction since we are no longer
guaranteed to hop in the caller after such a function returns.

rdar://155465878
@gottesmm gottesmm force-pushed the pr-0b35d691a2ceae00c6e9727dd57aeedb631d207c branch from b2cf160 to 734f057 Compare August 10, 2025 21:58
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm enabled auto-merge August 10, 2025 21:58
@gottesmm gottesmm merged commit fef7f53 into swiftlang:main Aug 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant